old_name = input("请输入文件名:")
index = old_name.rfind(".")
new_name = old_name[:index]+"备份"+old_name[index:]
# 老文件
old_f = open(old_name,"r")
# 新文件
new_f = open(new_name,"w")

cont = old_f.readlines()  # 老文件全部读取  返回一个列表
print(cont)
new_f.writelines(cont)

old_f.close()
new_f.close()

"""asd.txt"""